<h2>xml.js</h2>
<p>Useful function for xml access and manipulation.</p>
<hr/>

<h3>Functions</h3>
<ul>
	<li><a href="#createxmldoc">OAT.Xml.createXmlDoc(string)</a></li>
	<li><a href="#transformxslt">OAT.Xml.transformXSLT(xmlDoc, xslDoc, paramsArray)</a></li>
	<li><a href="#textvalue">OAT.Xml.textValue(node)</a></li>
	<li><a href="#localname">OAT.Xml.localName(node)</a></li>
	<li><a href="#childelements">OAT.Xml.childElements(node)</a></li>
	<li><a href="#getelementsbylocalname">OAT.Xml.getElementsByLocalName(node, localName)</a></li>
	<li><a href="#getlocalattribute">OAT.Xml.getLocalAttribute(node, attributeName)</a></li>
	<li><a href="#removedefaultnamespace">OAT.Xml.removeDefaultNamespace(string)</a></li>
	<li><a href="#xpath">OAT.Xml.xpath(xmlDoc, xpath, nsObject)</a></li>
</ul>

<hr/>

<h3><a name="createxmldoc">OAT.Xml.createXmlDoc(string)</a></h3>
<p>Parses a <em>string</em> of XML data and returns a <em>document</em> object.</p>

<h3><a name="transformxslt">OAT.Xml.transformXSLT(xmlDoc, xslDoc, paramsArray)</a></h3>
<p>Applies a XSLT template. <em>xslDoc</em> is a template to be applied to <em>xmlDoc</em>. Both arguments need to be valid
 xml documents (not strings). The third (optional) argument is an array of XSLT parameters. Each parameter is a triple (array), 
which consists of Namespace, Name and Value.</p>
<pre class="code">
var xmlDoc, xslDoc; // somehow will these with data
var params = [
	["myNS","myparam1","myvalue1"],
	["myNS","myparam2","myvalue2"]
]
var result = OAT.Xml.transformXSLT(xmlDoc, xslDoc, params);
</pre>
 
<h3><a name="textvalue">OAT.Xml.textValue(node)</a></h3>
<p>Returns a text value of <em>node</em>. So, for this markup:</p>
<p class="code">
&lt;tag&gt;content&lt;/tag&gt;
</p>
The textValue of <em>tag</em> is <em>content</em>.
 
<h3><a name="localname">OAT.Xml.localName(node)</a></h3>
<p>Returns <em>node</em>'s local name - the part without namespace prefix. &lt;xsl:template&gt; has a localName <em>template</em>.

<h3><a name="childelements">OAT.Xml.childElements(node)</a></h3>
<p>Returns all child nodes which are ordinary elements (i.e. no #text nodes etc.).</p> 

<h3><a name="getelementsbylocalname">OAT.Xml.getElementsByLocalName(node, localName)</a></h3>
<p>Identical to getElementsByTagName, but looks only into non-namespace part of tag name.</p> 

<h3><a name="getlocalattribute">OAT.Xml.getLocalAttribute(node, attributeName)</a></h3>
<p>Returns a value of attribute whose non-prefixed name is <em>attributeName</em></p> 

<h3><a name="removedefaultnamespace">OAT.Xml.removeDefaultNamespace(string)</a></h3>
<p>Takes a XML document (in <em>string</em> form) and removes default namespace. This is useful when we want to use XPath queries 
against such document, since these cannot be executed agains documents with default namespaces. Returns XML string.</em></p> 

<h3><a name="xpath">OAT.Xml.xpath(xmlDoc, xpath, nsObject)</a></h3>
<p>Runs a <em>xpath</em> query against <em>xmlDoc</em>. Namespaces are resolved as properties of <em>nsObject</em>. Example:</p>

<p class="code">
var xmlString = '&lt;?xml version="1.0" ?&gt;&lt;document&gt;&lt;node&gt;value&lt;/node&gt;&lt;node /&gt;&lt;/document&gt;';<br/>
var xmlDoc = OAT.Xml.createXmlDoc(xmlString);<br/>
var nodeArray = OAT.Xml.xpath(xmlDoc, '//node', {});<br/>
alert(nodeArray.length); // 2
</p>
